package com.liyiqing.secondhandmall.productservice.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.Date;

import com.liyiqing.commonservice.validator.ListValue;
import com.liyiqing.commonservice.validator.methodgroup.AddGroup;
import com.liyiqing.commonservice.validator.methodgroup.DeleteGroup;
import com.liyiqing.commonservice.validator.methodgroup.UpdateGroup;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;

/**
 * spu商品图片
 * 
 * @author LiYiQing
 * @email 1570865668@qq.com
 * @date 2022-02-18 23:36:20
 */
@Data
@TableName("product_spu_images")
public class ProductSpuImagesEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 图片id
	 */
	@TableId
	@Null(message = "新增时不可指定图片id",groups = {AddGroup.class})
	@NotNull(message = "修改或删除时必须指定图片id",groups = {UpdateGroup.class, DeleteGroup.class})
	private Long id;
	/**
	 * 商品id
	 */
	@NotNull(message = "新增时商品id不能为空",groups = {AddGroup.class})
	private Long spuId;
	/**
	 * 图片地址
	 */
	@NotBlank(message = "图片地址不能为空",groups = {AddGroup.class})
	@URL(message = "图片地址为无效的url",groups = {AddGroup.class,UpdateGroup.class})
	private String imgUrl;
	/**
	 * 图片顺序
	 */
	@Min(value = 0,message = "图片顺序需为正整数",groups = {AddGroup.class})
	private Integer imgSort;
	/**
	 * 图片状态：0删除；1可用
	 */
	@TableLogic(value="1",delval="0")
	@ListValue(values = {0,1},message = "账号状态只能是:【1(可用)】or【0(删除)】")
	private Integer status;

}
